import fetch from './fetch'

/**
 * 登陆
 */
export const login = data => fetch('/user/login', data, 'POST',true);
/**
 * 退出
 */
export const logout = data => fetch('/Account/Logout', data, 'POST');

export const modifyPwd = data => fetch('/user/modify_pwd', data, 'POST');

/**
 * 菜单
 */
export const functionTreeGrid = data => fetch('/function/all_list', data, 'POST');
export const parentFunctionList = data => fetch('/function/p_function', data, 'POST');
export const saveFunction = data => fetch('/function/save', data, 'POST', true);
export const delFunction = data => fetch('/function/delete', data, 'POST', true);
/**
 * 获取按钮权限list
 */
export const actionList = data => fetch('/action/getbyfunid', data, 'POST');
export const saveAction = data => fetch('/action/save', data, 'POST', true);


/**
 * 角色
 */
export const rolePagedList = data => fetch('/role/list', data, 'POST');
export const saveRole = data => fetch('/role/save', data, 'POST', true);
export const delRole = data => fetch('/role/delete', data, 'POST', true);
export const roleTree = data => fetch('/role/tree', data, 'POST');
export const setRoleTree = data => fetch('/role/set_tree', data, 'POST',true);
export const roleComboList = data => fetch('/role/combo', data, 'POST');
/**
 * 获取操作日志list
 */
export const operationLogPagedList = data => fetch('/OperationLog/List_OperationLog', data, 'POST');
/**
 * 用户
 */
export const userPagedList = data => fetch("/user/list", data, "POST");
export const saveUser = data => fetch("/user/save", data, "POST", true);
export const delUser = data => fetch("/user/delete", data, "POST", true);
export const resetUserPwd = data => fetch("/user/reset_pwd", data, "POST", true);

/**
 * 部门
 */
export const deptPagedList = data => fetch("/dep/list", data, "POST");
export const getAdmin = data => fetch("/dep/admin", data, "POST");
export const getdeptList = data => fetch("/dep/city_admin", data, "POST");
export const getAreasCascader = data => fetch("/dep/city_area", data, "POST");
export const saveDept = data => fetch("/dep/save", data, "POST", true);
export const delDept = data => fetch("/dep/delete", data, "POST", true); 

/**
 * 日志
 */
export const logPagedList = data => fetch('/log/list', data, 'POST');


// region 设备管理

export const getDevicePagedList = data => fetch('/devices/list', data, 'POST');
export const saveDevice = data => fetch('/devices/save', data, 'POST', true);
export const delDevice = data => fetch('/devices/delete', data, 'POST', true);
export const areasBuildingsCascader = data => fetch('/devices/area_gc_bd', data, 'POST');
export const getDeviceListExcel = data => fetch('/devices/export', data, 'POST');

// endregion

// region 微信用户

//export const getMobileCusPagedList = data => fetch('/Mobile_Cus/List_Mobile_Cus', data, 'POST');
//export const editMobileCus = data => fetch('/Mobile_Cus/Edit_Mobile_Cus', data, 'POST', true);

// endregion

// region 联网单位管理

// 地区
export const getAreasPagedList = data => fetch('/Smk_Areas/List_Smk_Areas', data, 'POST');
export const saveAreas = data => fetch('/Smk_Areas/Edit_Smk_Areas', data, 'POST', true);
export const delAreas = data => fetch('/Smk_Areas/Delete_Smk_Areas', data, 'POST', true);

// 联网单位
export const getGroupCompanyPagedList = data => fetch('/gcp/list', data, 'POST');
export const saveGroupCompany = data => fetch('/gcp/save', data, 'POST', true);
export const delGroupCompany = data => fetch('/gcp/delete', data, 'POST', true);
// 子单位
export const getBuildingsPagedList = data => fetch('/building/list', data, 'POST');
export const getBuildingsAll = data => fetch('/building/listall', data, 'POST');
export const saveBuilding = data => fetch('/building/save', data, 'POST', true);
export const delBuilding = data => fetch('/building/delete', data, 'POST', true);
export const getBuildingbyid = data => fetch('/building/getbyid', data, 'POST', true);
// 维保单位
export const getMaintenancePagedList = data => fetch('/mtc/list', data, 'POST');
export const getMaintenanceCombo = data => fetch('/mtc/combo', data, 'POST');
export const saveMaintenance = data => fetch('/mtc/save', data, 'POST', true);
export const delMaintenance = data => fetch('/mtc/delete', data, 'POST', true);

// endregion

// region 首页

export const getAlarmPagedList = data => fetch('/alarm/list', data, 'POST');
export const alarmCount = data => fetch('/alarm/count', data, 'POST');
export const saveAlarm = data => fetch('/alarm/save', data, 'POST');
export const alarmXY = data => fetch('/alarm/xy', data, 'POST');
// endregion

// region 大屏展示

export const getAlarmChart = data => fetch('/screen/chart', data, 'POST');
export const getShopLocation = data => fetch('/screen/shops', data, 'POST');
// endregion

// region 心跳

export const getHeartBeatPagedList = data => fetch('/heart/list', data, 'POST');
// endregion
